<template>
  <view class="vaccine-container">
    <!-- 顶部banner -->
    <view class="banner">
      <image src="/static/vaccine/banner.jpg" mode="aspectFill" class="bg-image" />
      <view class="content">
        <text class="title">疫苗接种预约</text>
        <text class="desc">便捷预约，安全接种</text>
      </view>
    </view>
    
    <!-- 快速入口 -->
    <view class="quick-access">
      <view class="access-item" @tap="navigateTo('/pages/vaccine/book')">
        <image src="/static/vaccine/book.png" mode="aspectFit" class="icon" />
        <text>预约接种</text>
      </view>
      <view class="access-item" @tap="navigateTo('/pages/vaccine/record')">
        <image src="/static/vaccine/record.png" mode="aspectFit" class="icon" />
        <text>接种记录</text>
      </view>
      <view class="access-item" @tap="navigateTo('/pages/vaccine/list')">
        <image src="/static/vaccine/list.png" mode="aspectFit" class="icon" />
        <text>疫苗列表</text>
      </view>
    </view>
    
    <!-- 疫苗分类 -->
    <view class="vaccine-types">
      <view class="section-title">疫苗分类</view>
      <view class="type-list">
        <view 
          class="type-item"
          v-for="(type, index) in vaccineTypes"
          :key="index"
          @tap="navigateToList(type)"
        >
          <image :src="type.icon" mode="aspectFit" class="icon" />
          <text class="name">{{ type.name }}</text>
          <text class="desc">{{ type.desc }}</text>
        </view>
      </view>
    </view>
    
    <!-- 接种点推荐 -->
    <view class="clinic-recommend">
      <view class="section-title">接种点推荐</view>
      <view class="clinic-list">
        <view 
          class="clinic-item"
          v-for="(clinic, index) in clinics"
          :key="index"
          @tap="navigateToClinic(clinic)"
        >
          <image :src="clinic.image" mode="aspectFill" class="image" />
          <view class="info">
            <text class="name">{{ clinic.name }}</text>
            <text class="address">{{ clinic.address }}</text>
            <view class="tags">
              <text v-for="(tag, idx) in clinic.tags" :key="idx">{{ tag }}</text>
            </view>
          </view>
        </view>
      </view>
    </view>
    
    <!-- 温馨提示 -->
    <view class="notice-card">
      <view class="section-title">温馨提示</view>
      <view class="notice-list">
        <view class="notice-item" v-for="(notice, index) in notices" :key="index">
          <text class="dot"></text>
          <text class="content">{{ notice }}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'

// 疫苗分类
const vaccineTypes = ref([
  {
    id: 1,
    name: '儿童疫苗',
    desc: '0-6岁常规接种',
    icon: '/static/vaccine/child.png'
  },
  {
    id: 2,
    name: '成人疫苗',
    desc: '18岁以上人群',
    icon: '/static/vaccine/adult.png'
  },
  {
    id: 3,
    name: '老年疫苗',
    desc: '60岁以上人群',
    icon: '/static/vaccine/elder.png'
  },
  {
    id: 4,
    name: '流感疫苗',
    desc: '季节性接种',
    icon: '/static/vaccine/flu.png'
  }
])

// 接种点列表
const clinics = ref([
  {
    id: 1,
    name: '澳门镜湖医院预防接种门诊',
    address: '澳门连胜马路33号',
    image: '/static/hospital/kiang-wu.jpg',
    tags: ['全天候接种', '可预约', '免费停车']
  },
  {
    id: 2,
    name: '澳门科大医院疫苗中心',
    address: '澳门氹仔大学大马路',
    image: '/static/hospital/must.jpg',
    tags: ['专业团队', '环境舒适', '交通便利']
  }
])

// 温馨提示
const notices = [
  '请携带身份证件和接种本',
  '接种前请保持良好的身体状态',
  '接种后请在现场留观30分钟',
  '如有不适请及时就医'
]

// 页面跳转
const navigateTo = (url) => {
  uni.navigateTo({ url })
}

// 跳转到疫苗列表
const navigateToList = (type) => {
  uni.navigateTo({
    url: `/pages/vaccine/list?typeId=${type.id}&typeName=${type.name}`
  })
}

// 跳转到接种点详情
const navigateToClinic = (clinic) => {
  uni.navigateTo({
    url: `/pages/hospital/detail?id=${clinic.id}`
  })
}
</script>

<style lang="scss">
.vaccine-container {
  min-height: 100vh;
  background: $bg-color;
  
  .banner {
    position: relative;
    height: 300rpx;
    
    .bg-image {
      width: 100%;
      height: 100%;
    }
    
    .content {
      position: absolute;
      left: 40rpx;
      bottom: 40rpx;
      color: #fff;
      
      .title {
        font-size: 40rpx;
        font-weight: bold;
        margin-bottom: 12rpx;
        display: block;
      }
      
      .desc {
        font-size: 28rpx;
        opacity: 0.9;
      }
    }
  }
  
  .quick-access {
    margin: -40rpx 20rpx 0;
    padding: 30rpx;
    background: #fff;
    border-radius: $radius-lg;
    display: flex;
    justify-content: space-around;
    box-shadow: $shadow-sm;
    
    .access-item {
      text-align: center;
      
      .icon {
        width: 80rpx;
        height: 80rpx;
        margin-bottom: 12rpx;
      }
      
      text {
        font-size: 26rpx;
        color: $text-regular;
      }
      
      &:active {
        opacity: 0.8;
      }
    }
  }
  
  .section-title {
    font-size: 32rpx;
    color: $text-primary;
    font-weight: bold;
    margin-bottom: 20rpx;
  }
  
  .vaccine-types {
    margin: 30rpx 20rpx;
    
    .type-list {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 20rpx;
      
      .type-item {
        background: #fff;
        border-radius: $radius-lg;
        padding: 30rpx;
        box-shadow: $shadow-sm;
        
        .icon {
          width: 80rpx;
          height: 80rpx;
          margin-bottom: 16rpx;
        }
        
        .name {
          font-size: 30rpx;
          color: $text-primary;
          font-weight: bold;
          margin-bottom: 8rpx;
          display: block;
        }
        
        .desc {
          font-size: 24rpx;
          color: $text-secondary;
        }
        
        &:active {
          transform: scale(0.98);
        }
      }
    }
  }
  
  .clinic-recommend {
    margin: 30rpx 20rpx;
    
    .clinic-list {
      .clinic-item {
        background: #fff;
        border-radius: $radius-lg;
        margin-bottom: 20rpx;
        box-shadow: $shadow-sm;
        overflow: hidden;
        
        .image {
          width: 100%;
          height: 300rpx;
        }
        
        .info {
          padding: 20rpx;
          
          .name {
            font-size: 32rpx;
            color: $text-primary;
            font-weight: bold;
            margin-bottom: 8rpx;
            display: block;
          }
          
          .address {
            font-size: 26rpx;
            color: $text-regular;
            margin-bottom: 16rpx;
            display: block;
          }
          
          .tags {
            display: flex;
            flex-wrap: wrap;
            gap: 12rpx;
            
            text {
              font-size: 22rpx;
              color: $primary-color;
              background: $primary-light;
              padding: 4rpx 12rpx;
              border-radius: $radius-sm;
            }
          }
        }
        
        &:active {
          transform: scale(0.99);
        }
      }
    }
  }
  
  .notice-card {
    margin: 30rpx 20rpx;
    background: #fff;
    border-radius: $radius-lg;
    padding: 30rpx;
    box-shadow: $shadow-sm;
    
    .notice-list {
      .notice-item {
        display: flex;
        align-items: flex-start;
        margin-bottom: 16rpx;
        
        &:last-child {
          margin-bottom: 0;
        }
        
        .dot {
          width: 12rpx;
          height: 12rpx;
          background: $primary-color;
          border-radius: 50%;
          margin-top: 12rpx;
          margin-right: 12rpx;
          flex-shrink: 0;
        }
        
        .content {
          flex: 1;
          font-size: 26rpx;
          color: $text-regular;
          line-height: 1.6;
        }
      }
    }
  }
  
  .scroll-view {
    white-space: nowrap;
    padding: 0 20rpx;
    &::-webkit-scrollbar {
      display: none;
    }
  }
}
</style>